package com.ashin.controller;

import cn.zhouyafeng.itchat4j.api.MessageTools;
import cn.zhouyafeng.itchat4j.api.WechatTools;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Controller;

import java.util.Date;

@Controller
public class MyJob {


    @Scheduled(cron = "5 0/5 23-23,0-8 * * ?") // 23:00到早上9:00,每隔5分钟执行一次
    public void myTask() {
        System.out.println("定时任务执行时间：" + new Date());
        // 在这里编写定时任务的逻辑
        if (WechatTools.getWechatStatus()) {
            MessageTools.sendMsgByNickName("干啥呢？" + new Date(), "文文");
        }

    }
}
